package mr;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;

public class Test2 {

    public static void main(String[] args)throws Exception {

        int count = countFileLine();
//        System.out.println(count);

        int FileRow = count / 128;

        BufferedReader br = new BufferedReader(new FileReader("F:\\数加\\代码\\nanshan\\date\\bigstudents.txt"));

        int index=0;
        BufferedWriter bw = new BufferedWriter(new FileWriter("F:\\数加\\代码\\nanshan\\split\\split--"+index));

        String line;
        int flag=0;

        while ((line= br.readLine())!=null){
            flag++;
            if (flag>128){
                bw.flush();
                bw.close();
                index++;
                flag=0;
                bw=new BufferedWriter(new FileWriter("F:\\数加\\代码\\nanshan\\split\\split--"+index));

            }
            bw.write(line);

            bw.newLine();


        }
        bw.close();
        br.close();

    }


    public static int countFileLine()throws Exception{

        int count=0;
        BufferedReader br = new BufferedReader(new FileReader("F:\\数加\\代码\\nanshan\\date\\bigstudents.txt"));

        while (br.readLine() !=null){

            count++;
        }
        return count;

    }

}
